package cn.jsj.invite.controller;

import cn.jsj.invite.pojo.InvitationInfo;
import cn.jsj.invite.result.Result;
import cn.jsj.invite.service.RecommendationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashSet;
import java.util.List;

@RestController
@CrossOrigin
public class IntelligentRecommendationController {

    private final RecommendationService recommendationService;

    public IntelligentRecommendationController(RecommendationService recommendationService) {
        this.recommendationService = recommendationService;
    }

    @GetMapping("/studentFindWork")
    public Result<?> studentFindWork(Integer studentId) {
        List<InvitationInfo> invitationInfos = recommendationService.studentFindWork(studentId);
        if (invitationInfos == null) {
            return Result.fail("找不到该学生的信息");
        }
        if (invitationInfos.size() == 0) {
            return Result.fail("找不到合适的岗位");
        }
        return Result.success(invitationInfos);
    }

}
